﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:SLS.Controls"
                    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                    xmlns:converts="clr-namespace:SLS.ExClassLib.Converters;assembly=Converters"
                    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                    mc:Ignorable="d">
    <converts:BooleanToVisibilityConverter x:Key="BooleanToVisibilityCon" />
    <!-- Special TabControl that keeps all items in memory but changes Visibility, rather create
         entire VisualTree for SelectedItem from Stratch which if using MefedMVVM would mean a new
         View would be created with a new ViewModel, which means loss of state. Yikes -->
    <SolidColorBrush x:Key="TabControlNormalBorderBrush"
                     Color="#8C8E94" />
    <SolidColorBrush x:Key="TabBorderBrush"
                     Color="#FF00CE29" />
    <RadialGradientBrush x:Key="selectedGradientGlow">
        <GradientStop Color="#FF82F98F"
                      Offset="0" />
        <GradientStop Color="#0059FF6B"
                      Offset="1" />
    </RadialGradientBrush>
    <SolidColorBrush  x:Key="selectedBrush"
                      Color="#FF00CE29" />
    <SolidColorBrush  x:Key="nonSelectedBrush"
                      Color="#bF00CE29" />
    <LinearGradientBrush EndPoint="0.5,1"
                         StartPoint="0.5,0"
                         x:Key="verticalTabHeaderBackground">
        <GradientStop Color="#ff1C1E1D"
                      Offset="0" />
        <GradientStop Color="#ff423F2C"
                      Offset="1" />
    </LinearGradientBrush>
    <Style x:Key="TabControlStyleVerticalTabs"
           TargetType="{x:Type local:ExTabControl}">
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="Padding"
                Value="0" />
        <Setter Property="BorderThickness"
                Value="1" />
        <Setter Property="BorderBrush"
                Value="{StaticResource TabControlNormalBorderBrush}" />
        <Setter Property="Background"
                Value="White" />
        <Setter Property="HorizontalContentAlignment"
                Value="Center" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ExTabControl}">
                    <DockPanel Background="{StaticResource verticalTabHeaderBackground}">
                        <TabPanel x:Name="tabpanel"
                                  Margin="0,15,0,0"
                                  Visibility="Visible"
                                  DockPanel.Dock="Left"
                                  KeyboardNavigation.TabIndex="1"
                                  IsItemsHost="True" />
                        <Border  CornerRadius="10,0,0,10"
                                 Margin="0,5,0,5"
                                 Background="{TemplateBinding Background}">
                            <Grid DockPanel.Dock="Bottom"
                                  Margin="10,0,0,0"
                                  Background="{TemplateBinding Background}"
                                  x:Name="PART_ItemsHolder" />
                        </Border>
                    </DockPanel>
                    <!-- no content presenter -->
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TabItemStyleVerticalTabs"
           TargetType="{x:Type TabItem}">
        <Setter Property="FocusVisualStyle"
                Value="{x:Null}" />
        <Setter Property="Foreground"
                Value="Black" />
        <Setter Property="Padding"
                Value="0" />
        <Setter Property="HorizontalContentAlignment"
                Value="Stretch" />
        <Setter Property="VerticalContentAlignment"
                Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid SnapsToDevicePixels="true">
                        <Border x:Name="Bd"
                                BorderThickness="0">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="2" />
                                </Grid.RowDefinitions>
                                <Grid Grid.Row="0">
                                    <Grid  x:Name="grid"
                                           Margin="0"
                                           HorizontalAlignment="Stretch"
                                           VerticalAlignment="Stretch" />
                                    <StackPanel Orientation="Horizontal"
                                                Margin="15,5,15,5">
                                        <Button x:Name="PART_Close"
                                                HorizontalAlignment="Left"
                                                Margin="2,0,2,0"
                                                VerticalAlignment="Center"
                                                Width="16"
                                                Height="16"
                                                Command="{Binding Path=CloseWorkSpaceCommand}"
                                                Visibility="{Binding IsCloseable, 
                                                Converter={StaticResource BooleanToVisibilityCon}, 
                                                ConverterParameter=True}"
                                                Focusable="False"
                                                Style="{DynamicResource CloseableTabItemButtonStyle}"
                                                ToolTip="Close Tab">
                                            <Path x:Name="Path"
                                                  Stretch="Fill"
                                                  StrokeThickness="0.5"
                                                  Stroke="{DynamicResource closeTabCrossStroke}"
                                                  Fill="Black"
                                                  Data="F1 M 2.28484e-007,1.33331L 1.33333,0L 4.00001,2.66669L 6.66667,6.10352e-005L 8,1.33331L 5.33334,4L 8,6.66669L 6.66667,8L 4,5.33331L 1.33333,8L 1.086e-007,6.66669L 2.66667,4L 2.28484e-007,1.33331 Z "
                                                  HorizontalAlignment="Stretch"
                                                  VerticalAlignment="Stretch" />
                                        </Button>
                                        <Image Source="{Binding ImagePath}"
                                               Width="32"
                                               Height="32"
                                               Margin="2,0,2,0"
                                               Visibility="{Binding HasImage, 
                                                Converter={StaticResource BooleanToVisibilityCon}, 
                                                ConverterParameter=True}"
                                               VerticalAlignment="Center" />
                                        <Label x:Name="lbl"
                                               Margin="2,0,2,0"
                                               FontSize="12"
                                               FontWeight="Bold"
                                               Content="{Binding Path=DisplayText}"
                                               HorizontalAlignment="Left"
                                               VerticalAlignment="Center" />
                                    </StackPanel>
                                    <Label x:Name="lblArrow"
                                           FontFamily="Wingdings 3"
                                           Content="t"
                                           FontSize="16"
                                           Foreground="White"
                                           Margin="0,0,-9,0"
                                           Opacity="0"
                                           VerticalAlignment="Center"
                                           VerticalContentAlignment="Center"
                                           HorizontalAlignment="Right"
                                           HorizontalContentAlignment="Right" />
                                </Grid>
                                <Rectangle x:Name="rectShine"
                                           Grid.Row="1"
                                           Opacity="0.5"
                                           Fill="#ff656565"
                                           StrokeThickness="0"
                                           HorizontalAlignment="Stretch"
                                           VerticalAlignment="Stretch"
                                           Height="2" />
                            </Grid>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected"
                                           Value="true" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Panel.ZIndex"
                                    Value="1" />
                            <Setter Property="Background"
                                    TargetName="Bd"
                                    Value="{StaticResource selectedBrush}" />
                            <Setter Property="Background"
                                    TargetName="grid"
                                    Value="{StaticResource selectedGradientGlow}" />
                            <Setter Property="Opacity"
                                    TargetName="lblArrow"
                                    Value="1" />
                            <Setter Property="Height"
                                    TargetName="rectShine"
                                    Value="2" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected"
                                           Value="false" />
                                <Condition Property="IsMouseOver"
                                           Value="true" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Panel.ZIndex"
                                    Value="1" />
                            <Setter Property="Background"
                                    TargetName="Bd"
                                    Value="{StaticResource nonSelectedBrush}" />
                            <Setter Property="Background"
                                    TargetName="grid"
                                    Value="Transparent" />
                            <Setter Property="Opacity"
                                    TargetName="lblArrow"
                                    Value="0" />
                            <Setter Property="Height"
                                    TargetName="rectShine"
                                    Value="2" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected"
                                           Value="false" />
                                <Condition Property="IsMouseOver"
                                           Value="false" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Height"
                                    TargetName="rectShine"
                                    Value="0" />
                            <Setter Property="Foreground"
                                    TargetName="lbl"
                                    Value="White" />
                            <Setter Property="Fill"
                                    TargetName="Path"
                                    Value="White" />
                        </MultiTrigger>
                        <Trigger Property="TabStripPlacement"
                                 Value="Right">
                            <Setter Property="Content"
                                    TargetName="lblArrow"
                                    Value="u" />
                            <Setter Property="Margin"
                                    TargetName="lblArrow"
                                    Value="-9,0,0,0" />
                            <Setter Property="HorizontalAlignment"
                                    TargetName="lblArrow"
                                    Value="Left" />
                            <Setter Property="HorizontalContentAlignment"
                                    TargetName="lblArrow"
                                    Value="Left" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TabControlStyleSideTabs"
           TargetType="{x:Type local:ExTabControl}">
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="Padding"
                Value="0" />
        <Setter Property="BorderThickness"
                Value="1" />
        <Setter Property="BorderBrush"
                Value="{StaticResource TabControlNormalBorderBrush}" />
        <Setter Property="Background"
                Value="White" />
        <Setter Property="HorizontalContentAlignment"
                Value="Center" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ExTabControl}">
                    <DockPanel Background="{StaticResource verticalTabHeaderBackground}">
                        <TabPanel x:Name="tabpanel"
                                  Margin="0,15,0,0"
                                  Visibility="Visible"
                                  DockPanel.Dock="Left"
                                  KeyboardNavigation.TabIndex="1"
                                  IsItemsHost="True" />
                        <Border  CornerRadius="10,0,0,10"
                                 Margin="0,5,0,5"
                                 Background="{TemplateBinding Background}">
                            <Grid DockPanel.Dock="Bottom"
                                  Margin="10,0,0,0"
                                  Background="{TemplateBinding Background}"
                                  x:Name="PART_ItemsHolder" />
                        </Border>
                    </DockPanel>
                    <!-- no content presenter -->
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TabItemStyleSideTabs"
           TargetType="{x:Type TabItem}">
        <Setter Property="FocusVisualStyle"
                Value="{x:Null}" />
        <Setter Property="Foreground"
                Value="Black" />
        <Setter Property="Padding"
                Value="0" />
        <Setter Property="HorizontalContentAlignment"
                Value="Stretch" />
        <Setter Property="VerticalContentAlignment"
                Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid SnapsToDevicePixels="true">
                        <Border x:Name="Bd"
                                BorderThickness="0">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="2" />
                                </Grid.RowDefinitions>
                                <Grid Grid.Row="0">
                                    <Grid  x:Name="grid"
                                           Margin="0"
                                           HorizontalAlignment="Stretch"
                                           VerticalAlignment="Stretch" />
                                    <StackPanel
                                                Margin="15,5,15,5">
                                        <Button x:Name="PART_Close"
                                                HorizontalAlignment="Left"
                                                Margin="2,0,2,0"
                                                VerticalAlignment="Center"
                                                Width="16"
                                                Height="16"
                                                Command="{Binding Path=CloseWorkSpaceCommand}"
                                                Visibility="{Binding IsCloseable, 
                                                Converter={StaticResource BooleanToVisibilityCon}, 
                                                ConverterParameter=True}"
                                                Focusable="False"
                                                Style="{DynamicResource CloseableTabItemButtonStyle}"
                                                ToolTip="Close Tab">
                                            <Path x:Name="Path"
                                                  Stretch="Fill"
                                                  StrokeThickness="0.5"
                                                  Stroke="{DynamicResource closeTabCrossStroke}"
                                                  Fill="Black"
                                                  Data="F1 M 2.28484e-007,1.33331L 1.33333,0L 4.00001,2.66669L 6.66667,6.10352e-005L 8,1.33331L 5.33334,4L 8,6.66669L 6.66667,8L 4,5.33331L 1.33333,8L 1.086e-007,6.66669L 2.66667,4L 2.28484e-007,1.33331 Z "
                                                  HorizontalAlignment="Stretch"
                                                  VerticalAlignment="Stretch" />
                                        </Button>
                                        <Label x:Name="lbl"
                                               Margin="2,0,2,0"
                                               FontSize="12"
                                               FontWeight="Bold"
                                               Content="{Binding Path=DisplayText}"
                                               HorizontalAlignment="Left"
                                               VerticalAlignment="Center"></Label>
                                    </StackPanel>
                                    <Label x:Name="lblArrow"
                                           FontFamily="Wingdings 3"
                                           Content="t"
                                           FontSize="16"
                                           Foreground="White"
                                           Margin="0,0,-9,0"
                                           Opacity="0"
                                           VerticalAlignment="Center"
                                           VerticalContentAlignment="Center"
                                           HorizontalAlignment="Right"
                                           HorizontalContentAlignment="Right" />
                                </Grid>
                                <Rectangle x:Name="rectShine"
                                           Grid.Row="1"
                                           Opacity="0.5"
                                           Fill="#ff656565"
                                           StrokeThickness="0"
                                           HorizontalAlignment="Stretch"
                                           VerticalAlignment="Stretch"
                                           Height="2" />
                            </Grid>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected"
                                           Value="true" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Panel.ZIndex"
                                    Value="1" />
                            <Setter Property="Background"
                                    TargetName="Bd"
                                    Value="{StaticResource selectedBrush}" />
                            <Setter Property="Background"
                                    TargetName="grid"
                                    Value="{StaticResource selectedGradientGlow}" />
                            <Setter Property="Opacity"
                                    TargetName="lblArrow"
                                    Value="1" />
                            <Setter Property="Height"
                                    TargetName="rectShine"
                                    Value="2" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected"
                                           Value="false" />
                                <Condition Property="IsMouseOver"
                                           Value="true" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Panel.ZIndex"
                                    Value="1" />
                            <Setter Property="Background"
                                    TargetName="Bd"
                                    Value="{StaticResource nonSelectedBrush}" />
                            <Setter Property="Background"
                                    TargetName="grid"
                                    Value="Transparent" />
                            <Setter Property="Opacity"
                                    TargetName="lblArrow"
                                    Value="0" />
                            <Setter Property="Height"
                                    TargetName="rectShine"
                                    Value="2" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected"
                                           Value="false" />
                                <Condition Property="IsMouseOver"
                                           Value="false" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Height"
                                    TargetName="rectShine"
                                    Value="0" />
                            <Setter Property="Foreground"
                                    TargetName="lbl"
                                    Value="White" />
                            <Setter Property="Fill"
                                    TargetName="Path"
                                    Value="White" />
                        </MultiTrigger>
                        <Trigger Property="TabStripPlacement"
                                 Value="Right">
                            <Setter Property="Content"
                                    TargetName="lblArrow"
                                    Value="u" />
                            <Setter Property="Margin"
                                    TargetName="lblArrow"
                                    Value="-9,0,0,0" />
                            <Setter Property="HorizontalAlignment"
                                    TargetName="lblArrow"
                                    Value="Left" />
                            <Setter Property="HorizontalContentAlignment"
                                    TargetName="lblArrow"
                                    Value="Left" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TabControlStyleTopTabs"
           TargetType="{x:Type local:ExTabControl}">
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="Padding"
                Value="0" />
        <Setter Property="BorderThickness"
                Value="1" />
        <Setter Property="BorderBrush"
                Value="{StaticResource TabControlNormalBorderBrush}" />
        <Setter Property="Background"
                Value="White" />
        <Setter Property="HorizontalContentAlignment"
                Value="Center" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:ExTabControl}">
                    <DockPanel Background="{StaticResource verticalTabHeaderBackground}">
                        <TabPanel x:Name="tabpanel"
                                  Margin="0,15,0,0"
                                  Visibility="Visible"
                                  DockPanel.Dock="Top"
                                  KeyboardNavigation.TabIndex="1"
                                  IsItemsHost="True" />
                        <Border  CornerRadius="10,0,0,10"
                                 Margin="0,5,0,5"
                                 Background="{TemplateBinding Background}">
                            <Grid DockPanel.Dock="Bottom"
                                  Margin="10,0,0,0"
                                  Background="{TemplateBinding Background}"
                                  x:Name="PART_ItemsHolder" />
                        </Border>
                    </DockPanel>
                    <!-- no content presenter -->
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="TabItemStyleTopTabs"
           TargetType="{x:Type TabItem}">
        <Setter Property="FocusVisualStyle"
                Value="{x:Null}" />
        <Setter Property="Foreground"
                Value="Black" />
        <Setter Property="Padding"
                Value="0" />
        <Setter Property="HorizontalContentAlignment"
                Value="Center" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Grid SnapsToDevicePixels="true">
                        <Border x:Name="Bd"
                                BorderThickness="0">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="*" />
                                    <RowDefinition Height="2" />
                                </Grid.RowDefinitions>
                                <Grid Grid.Row="0">
                                    <Grid  x:Name="grid"
                                           Margin="0"
                                           HorizontalAlignment="Left"
                                           VerticalAlignment="Center" />
                                    <StackPanel Orientation="Horizontal"
                                                Margin="0,0,0,0">
                                        <Button x:Name="PART_Close"
                                                HorizontalAlignment="Left"
                                                Margin="2,0,2,0"
                                                VerticalAlignment="Center"
                                                Width="16"
                                                Height="16"
                                                Command="{Binding Path=CloseWorkSpaceCommand}"
                                                Visibility="{Binding IsCloseable, 
                                                Converter={StaticResource BooleanToVisibilityCon}, 
                                                ConverterParameter=True}"
                                                Focusable="False"
                                                Style="{DynamicResource CloseableTabItemButtonStyle}"
                                                ToolTip="Close Tab">
                                            <Path x:Name="Path"
                                                  Stretch="Fill"
                                                  StrokeThickness="0.5"
                                                  Stroke="{DynamicResource closeTabCrossStroke}"
                                                  Fill="Black"
                                                  Data="F1 M 2.28484e-007,1.33331L 1.33333,0L 4.00001,2.66669L 6.66667,6.10352e-005L 8,1.33331L 5.33334,4L 8,6.66669L 6.66667,8L 4,5.33331L 1.33333,8L 1.086e-007,6.66669L 2.66667,4L 2.28484e-007,1.33331 Z "
                                                  HorizontalAlignment="Stretch"
                                                  VerticalAlignment="Stretch" />
                                        </Button>
                                        <Label x:Name="lbl"
                                               Margin="2,0,2,0"
                                               FontSize="12"
                                               FontWeight="Bold"
                                               Content="{Binding Path=DisplayText}"
                                               HorizontalAlignment="Left"
                                               VerticalAlignment="Center" />
                                    </StackPanel>
                                </Grid>
                                <Rectangle x:Name="rectShine"
                                           Grid.Row="1"
                                           Opacity="0.5"
                                           Fill="#ff656565"
                                           StrokeThickness="0"
                                           HorizontalAlignment="Stretch"
                                           VerticalAlignment="Stretch"
                                           Height="2" />
                            </Grid>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected"
                                           Value="true" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Panel.ZIndex"
                                    Value="1" />
                            <Setter Property="Background"
                                    TargetName="Bd"
                                    Value="{StaticResource selectedBrush}" />
                            <Setter Property="Background"
                                    TargetName="grid"
                                    Value="{StaticResource selectedGradientGlow}" />
                            <Setter Property="Height"
                                    TargetName="rectShine"
                                    Value="2" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected"
                                           Value="false" />
                                <Condition Property="IsMouseOver"
                                           Value="true" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Panel.ZIndex"
                                    Value="1" />
                            <Setter Property="Background"
                                    TargetName="Bd"
                                    Value="{StaticResource nonSelectedBrush}" />
                            <Setter Property="Background"
                                    TargetName="grid"
                                    Value="Transparent" />
                            <Setter Property="Height"
                                    TargetName="rectShine"
                                    Value="2" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected"
                                           Value="false" />
                                <Condition Property="IsMouseOver"
                                           Value="false" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Height"
                                    TargetName="rectShine"
                                    Value="0" />
                            <Setter Property="Foreground"
                                    TargetName="lbl"
                                    Value="White" />
                            <Setter Property="Fill"
                                    TargetName="Path"
                                    Value="White" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!-- MainTabControlTemplateEx -->
    <ControlTemplate x:Key="MainTabControlTemplateEx"
                     TargetType="{x:Type local:ExTabControl}">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition x:Name="row0"
                               Height="Auto" />
                <RowDefinition x:Name="row1"
                               Height="4" />
                <RowDefinition x:Name="row2"
                               Height="*" />
            </Grid.RowDefinitions>
            <TabPanel x:Name="tabpanel"
                      Background="{StaticResource OutlookButtonHighlight}"
                      Margin="0"
                      Grid.Row="0"
                      IsItemsHost="True" />
            <Grid x:Name="divider"
                  Grid.Row="1"
                  Background="Black"
                  HorizontalAlignment="Stretch" />
            <Grid x:Name="PART_ItemsHolder"
                  Grid.Row="2" />
        </Grid>
        <!-- no content presenter -->
        <ControlTemplate.Triggers>
            <Trigger Property="TabStripPlacement"
                     Value="Top">
                <Setter TargetName="tabpanel"
                        Property="Grid.Row"
                        Value="0" />
                <Setter TargetName="divider"
                        Property="Grid.Row"
                        Value="1" />
                <Setter TargetName="PART_ItemsHolder"
                        Property="Grid.Row"
                        Value="2" />
                <Setter TargetName="row0"
                        Property="Height"
                        Value="Auto" />
                <Setter TargetName="row1"
                        Property="Height"
                        Value="4" />
                <Setter TargetName="row2"
                        Property="Height"
                        Value="*" />
            </Trigger>
            <Trigger Property="TabStripPlacement"
                     Value="Bottom">
                <Setter TargetName="tabpanel"
                        Property="Grid.Row"
                        Value="2" />
                <Setter TargetName="divider"
                        Property="Grid.Row"
                        Value="1" />
                <Setter TargetName="PART_ItemsHolder"
                        Property="Grid.Row"
                        Value="0" />
                <Setter TargetName="row0"
                        Property="Height"
                        Value="*" />
                <Setter TargetName="row1"
                        Property="Height"
                        Value="4" />
                <Setter TargetName="row2"
                        Property="Height"
                        Value="Auto" />
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>
    <!-- Tab Close Button Style -->
    <Style x:Key="CloseableTabItemButtonStyle"
           TargetType="{x:Type Button}">
        <Setter Property="FocusVisualStyle"
                Value="{x:Null}" />
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="BorderBrush"
                Value="Transparent" />
        <Setter Property="BorderThickness"
                Value="1" />
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="HorizontalContentAlignment"
                Value="Center" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Padding"
                Value="4" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <Border SnapsToDevicePixels="true"
                                x:Name="Chrome"
                                Background="Transparent"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="2"
                                Opacity="0" />
                        <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                          HorizontalAlignment="{TemplateBinding 
                                HorizontalContentAlignment}"
                                          Margin="{TemplateBinding Padding}"
                                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                          RecognizesAccessKey="True" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver"
                                 Value="True">
                            <Setter Property="Opacity"
                                    TargetName="Chrome"
                                    Value="1" />
                        </Trigger>
                        <Trigger Property="IsPressed"
                                 Value="True">
                            <Setter Property="Opacity"
                                    TargetName="Chrome"
                                    Value="1" />
                        </Trigger>
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Foreground"
                                    Value="Green" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type TabItem}">
        <Setter Property="Padding"
                Value="5" />
        <Setter Property="Foreground"
                Value="Black" />
        <Setter Property="Background"
                Value="{StaticResource OutlookButtonHighlight}" />
        <Setter Property="HorizontalContentAlignment"
                Value="Stretch" />
        <Setter Property="VerticalContentAlignment"
                Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Border SnapsToDevicePixels="true"
                            x:Name="Bd"
                            Background="{TemplateBinding Background}"
                            BorderThickness="0"
                            BorderBrush="Black">
                        <DockPanel Width="Auto">
                            <Button x:Name="PART_Close"
                                    HorizontalAlignment="Center"
                                    Margin="3"
                                    VerticalAlignment="Center"
                                    Width="16"
                                    Height="16"
                                    Command="{Binding Path=CloseWorkSpaceCommand}"
                                    Visibility="{Binding IsCloseable, 
                                            Converter={StaticResource BooleanToVisibilityCon}, 
                                            ConverterParameter=True}"
                                    DockPanel.Dock="Right"
                                    Focusable="False"
                                    Style="{DynamicResource CloseableTabItemButtonStyle}"
                                    ToolTip="Close Tab">
                                <Path x:Name="Path"
                                      Stretch="Fill"
                                      StrokeThickness="0.5"
                                      Stroke="{DynamicResource closeTabCrossStroke}"
                                      Fill="Black"
                                      Data="F1 M 2.28484e-007,1.33331L 1.33333,0L 4.00001,2.66669L 6.66667,6.10352e-005L 8,1.33331L 5.33334,4L 8,6.66669L 6.66667,8L 4,5.33331L 1.33333,8L 1.086e-007,6.66669L 2.66667,4L 2.28484e-007,1.33331 Z "
                                      HorizontalAlignment="Stretch"
                                      VerticalAlignment="Stretch" />
                            </Button>
                            <Label x:Name="lbl"
                                   Content="{Binding Path=DisplayName}"
                                   VerticalAlignment="Center" />
                        </DockPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="Selector.IsSelected"
                                 Value="True">
                            <Setter Property="Background"
                                    TargetName="Bd"
                                    Value="Black" />
                            <Setter Property="TextElement.Foreground"
                                    TargetName="lbl"
                                    Value="Orange" />
                            <Setter Property="Fill"
                                    TargetName="Path"
                                    Value="Orange" />
                        </Trigger>
                        <Trigger Property="IsMouseOver"
                                 SourceName="PART_Close"
                                 Value="True">
                            <Setter Property="Fill"
                                    TargetName="Path"
                                    Value="Red" />
                        </Trigger>
                        <Trigger Property="IsPressed"
                                 SourceName="PART_Close"
                                 Value="True">
                            <Setter Property="Fill"
                                    TargetName="Path"
                                    Value="Red" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>